//
//  MoreViewController.m
//  CarNetwork
//
//  Created by fzuacm on 16/4/18.
//  Copyright © 2016年 fzu_z. All rights reserved.
//

#import "MoreViewController.h"
#import "joinTableViewCell.h"
#import "SignUpViewController.h"
#import "LoginInViewController.h"

@interface MoreViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UIImageView *_imageView;
    UITableView *_TableView;
}

@end

@implementation MoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatTableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma view
-(void)creatTableView
{
    _TableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height - 64)];
    _TableView.dataSource = self;
    _TableView.delegate = self;
    _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"default.png"]]];
    
    _TableView.backgroundColor = [UIColor clearColor];
    [_TableView setBackgroundView:_imageView];
    [self.view addSubview:_TableView];
    
}

#pragma delegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellID = @"joinTableViewCell";
    joinTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    cell.backgroundColor = nil;
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:cellID owner:self options:nil] lastObject];
        cell.joinLabel.textColor = [UIColor blackColor];
        NSString *sign = [NSString stringWithFormat:@"注册"];
        NSString *log = [NSString stringWithFormat:@"登录"];
        if (indexPath.row == 0) {
            cell.joinLabel.text = sign;
        }
        else if (indexPath.row == 1)
        {
            cell.joinLabel.text = log;
        }
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //注册 ，，登入
    switch (indexPath.row) {
        case 0:
        {
            SignUpViewController *sign=[[SignUpViewController alloc] init];
            [self.navigationController pushViewController:sign animated:YES];
        }
            break;
        case 1:
        {
            LoginInViewController *login =[[LoginInViewController alloc] init];
            [self.navigationController pushViewController:login animated:YES];
        }
            break;
            
        default:
            break;
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
